/**
 * Copyright (C), 2022-2025, www.bosssof.com.cn
 * @FileName RoleDTO.java
 * @Author Administrator
 * @Date 2022-9-28  18:08
 * @Description TODO
 * History:
 * <author> Administrator
 * <time> 2022-9-28  18:08
 * <version> 1.0.0
 * <desc> 该文件定义了前端对角色做增加和修改的时候传递后端的角色DTO对象
 */
package com.sd365.permission.centre.pojo.dto;


import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonFormat;

import com.sd365.common.core.common.pojo.dto.TenantBaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import javax.validation.constraints.NotNull;

import java.util.ArrayList;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;

import java.util.List;
/**
 * @Class RoleDTO
 * @Description 前端做角色增加和修改的时候传送对象的角色对象
 * @Author Administrator
 * @Date 2022-9-28  18:09
 * @version 1.0.0
 */
@ApiModel(value="角色管理增加和修改传输对象")
@Data
@AllArgsConstructor



public class RoleDTO implements Serializable {

    /**
     *  角色所包含的资源列表
     */
    private List<ResourceDTO> resourceDTOS=new ArrayList<>();

    /**
     * 角色名
     */
    @ApiModelProperty(value="name角色名")
    @NotNull(message = "角色名字不能为空")
    private String name;
    /**
     * 角色代码
     */
    @ApiModelProperty(value="code角色代码")
    @NotNull(message = "角色工号不能为空")
    private String code;

    /**
     * 备注
     */
    @ApiModelProperty(value="remark备注")
    private String remark;

    /**
     *  机构
     */
    private OrganizationDTO organizationDTO;
    /**
     *  公司
     */
    private CompanyDTO companyDTO;

    /**
     * 客户
     */
    private  TenantDTO tenantDTO;



    /**
     * 租户ID
     */
    private Long tenantId;
    /**
     * 机构ID
     */
    private Long orgId;
    /**
     * 公司ID
     */
    private Long companyId;
    private static final long serialVersionUID = -4183652945764463929L;

    private Long id;

    private Byte status=1;

    private Long createdBy;
    private String creator;


    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(example = "2018-10-01 12:18:48")
    private Date createdTime;

    private Long updatedBy;
    private String modifier;


    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @ApiModelProperty(example = "2018-10-01 12:18:48")
    private Date updatedTime;

    private Long version;

    public RoleDTO(List<ResourceDTO> resourceDTOList, String name, String code, String remark, OrganizationDTO organizationDTO, CompanyDTO companyDTO, TenantDTO tenantDTO) {
    this.resourceDTOS =resourceDTOList;
    this.name = name;
    this.code = code;
    this.remark = remark;
    this.organizationDTO = organizationDTO;
    this.companyDTO = companyDTO;
    this.tenantDTO = tenantDTO;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public RoleDTO(){
        organizationDTO = new OrganizationDTO();
        companyDTO = new CompanyDTO();
        tenantDTO = new TenantDTO();
    }
}
